import { defineStore, createPinia } from "pinia";
import { computed, ref } from "vue";
import persist from "pinia-plugin-persistedstate"; //导入持久化插件
const pinia = createPinia();
pinia.use(persist);
// 组合式
export const useCounterStore = defineStore(
  "counter",
  () => {
    const count = ref(2);
    const double = computed(() => {
      return count.value * 2;
    });
    const increment = () => {
      count.value++;
    };

    return { count, double, increment };
  },
  {
    persist: true, // 网页端生效
  }
);

export * from "./modules/system";
export * from "./modules/profile";
export default pinia;
